
<extend name="./base"/>
<block name="css">

</block>
<block name="page">
    <article class="page-container">
        <form class="form form-horizontal" id="form-admin-edit">
            <input type="hidden" class="input-text" value="{$Admin.id}" placeholder="" id="id" name="id">

            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3">登录名称：</label>
                <div class="formControls col-xs-6 col-sm-7">
                    {$Admin.username}
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>手机：</label>
                <div class="formControls col-xs-6 col-sm-7">
                    <input type="text" class="input-text validate[required,custom[phone]]" value="{$Admin.phone}" placeholder=""
                           id="phone" name="phone">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>邮箱：</label>
                <div class="formControls col-xs-6 col-sm-7">
                    <input type="text" class="input-text validate[required,custom[email]]" value="{$Admin.email}" placeholder="@" name="email"
                           id="email">
                </div>
            </div>

            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3">权限组：</label>
                <div class="formControls col-xs-6 col-sm-7 skin-minimal">
                    <volist name="GroupList" id="vo">
                        <div class="check-box">
                            <input type="checkbox" id="checkbox{$vo.id}" name="groups[]" value="{$vo.id}" {$vo.checked}>
                            <label for="checkbox{$vo.id}">{$vo.title}</label>
                        </div>
                    </volist>

                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3">备注：</label>
                <div class="formControls col-xs-8 col-sm-9">
                <textarea name="intro" cols="" rows="" class="textarea" placeholder="说点什么...100个字符以内" dragonfly="true"
                          onKeyUp="textarealength(this,100)">{$Admin.intro}</textarea>
                    <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
                </div>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                </div>
            </div>
        </form>
    </article>

</block>

<block name="script">
    <script type="text/javascript">
        $(function () {

            $('#form-admin-edit').validationEngine();

            $('.skin-minimal input').iCheck({
                checkboxClass: 'icheckbox-blue',
                radioClass: 'iradio-blue',
                increaseArea: '20%'
            });

            var flag = true;

            $('#form-admin-edit').submit(function () {
                if ($(this).validationEngine('validate')) {
                    if (!flag) {
                        return false;
                    }
                    flag = false;
                    $.post("{:U('admin_save')}", $(this).serialize(), function (result) {
                        if (result.status == 1) {
                            layer.alert(result.info, {icon:1}, function () {
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index); //再执行关闭
                            })
                        } else {
                            layer.alert(result.info, {icon:5},function () {

                            })
                        }
                        flag = true;
                    }, "json");
                }
                return false;
            });
        });
    </script>

</block>
